<?php
/* @var $this StudentsController  */
/* @var $model Students */
/* @var $form CActiveForm */
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . "/js/jquery.validity/jquery.validate.js",CClientScript::POS_END);
?>
	
	<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'user-form',
	"htmlOptions"=>array('class'=>'form-horizontal userform'),
	'enableAjaxValidation'=>false,
)); ?>
<?php  //echo $form->errorSummary($model); ?>



<fieldset>
<table class="table table-bordered">
  <tbody>
    <tr>
      <td>
        <h5 class="pull-left">文件上传</h5>
      </td>
    </tr>
    <tr>
      <td class="nolinebg" width="100%">

<div class="nocolumn">

</div>
<div class="control-group">
<label class="control-label" for="">文件名</label>
<div class="controls">
<?php echo $form->textField($model,'d_name',array('class'=>'input-large pull-left','maxlength'=>100,'name'=>"d_name")); ?>
<p class="error pull-left pl8">选填!</p>
</div>
</div>
<div class="control-group">
<label class="control-label" for="iphoto">上传文件</label>
<div class="controls">
<?php echo $form->textField($model,'d_source',array('class'=>'input-large pull-left','maxlength'=>100,'name'=>"d_source")); ?>	
<div class="pull-left">
<a class="btn btn-mini btn-danger 	"  onclick="openUploadFile('d_source','d_name')">文件<?=!$model->d_source?"上传":"修改"?></a>
</div>
<p for="d_source" class="error" style=""><?=isset($model->errors['d_source'])?join('',$model->errors['d_source']):""?></p>
<p class="pull-left pl8" style="<?=isset($model->errors['d_source'])?"":""?>">文件大小20k以下!</p>
</div>
</div>
      </td>
    </tr>
    <tr>
      <td>
<div class="form-actions">
<button type="submit" class="btn btn-primary" name="addsubmit" value="add"><?=!$model->isNewRecord?"修改":"添加"?>数据</button>&nbsp;
<?php if($model->isNewRecord){?>
<button type="reset" class="btn">重新填写</button>
<?php }?>
</div>
      </td>
    </tr>



  </tbody>

</table>
</fieldset>


<?php $this->endWidget(); ?>	
 </div>
<script>

$(document).ready(function() {
        $("#user-form").validate({
			autoCreateRanges:true	,
            errorClass: "error",
            errorElement: "p",
            rules: {                
				d_source: {
                    required:true
                },
            },
            messages: {               
				d_source: {
                    required: '请上传文件'
                },
            }
        });
    
	});

</script>
